package com.lgc.mine

import android.os.Bundle
import android.view.View
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.viewModels
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.lgc.common.base.BaseFragment
import com.lgc.mine.databinding.FragmentMineBinding
import com.lgc.service.room.EduDBHelper
import com.lgc.service.room.EduUserDataBase
import kotlinx.coroutines.GlobalScope

class MineFragment : BaseFragment() {
//    private val viewModel by viewModels<MineViewModel>()
    private val viewModel by lazy {ViewModelProvider(this).get(MineViewModel::class.java)}
    override fun getLayoutRes(): Int {
        return R.layout.fragment_mine
    }

    override fun bindView(view: View, savedInstanceState: Bundle?): ViewDataBinding? {
        return FragmentMineBinding.bind(view).apply {
            vm=viewModel

//            ARouter.getInstance().build("/login/login").navigation()
        }
    }

    override fun initConfig() {
//        EduDBHelper.getLiveUserInfo(requireContext()).obseverKt {
//            viewModel.liveUser.value= it.toString()
//        }
        EduDBHelper.getLiveUserInfo(requireContext()).observe(viewLifecycleOwner) {
//            viewModel.liveUser.value = it.toString()
        }
    }

    override fun initData() {
    }
}